<div class="md-modal md-effect-3" id="modal">
    <div class="md-content">
        <div class="modal-header">
            <button class="md-close close">&times;</button>
            <h4 class="modal-title">选择当前服务人员</h4>
        </div>
        <div class="modal-body">
            <div class="row">
                <div class="col-lg-12">
                    <div class="filter-block pull-left">
                        <div class="form-group pull-left">
                            <input type="text" class="form-control" placeholder="请输入姓名"
                                   ng-model="searchOfServant.name"/>
                        </div>
                        <a class="btn btn-success pull-left form-group" ng-click="getServantList()">搜索</a>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="main-box no-header clearfix">
                        <div class="main-box-body clearfix">
                            <div class="table-responsive">
                                <table class="table table-hover table-striped text-center">
                                    <thead>
                                    <tr>
                                        <th class="text-center"><span>服务人员列表</span></th>
                                        <th class="text-center"><span>操作</span></th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr role="row" class="odd" ng-repeat="item in servantList">
                                        <td>{{item.name}}</td>
                                        <td>
                                            <a class="btn btn-primary" ng-click="setServant(item)">选择</a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <ul class="pagination pull-right">
                                <li><a ng-click="changePageOfServant(1)">首页</a></li>
                                <li><a ng-show="currentPageOfServant>1" ng-click="changePageOfServant(currentPageOfServant-1)">
                                    <i class="fa fa-chevron-left"></i></a>
                                </li>
                                <li ng-repeat="item in pageListOfServant" ng-click="changePageOfServant(item.number)" class="{{item.active}}">
                                    <a>{{item.number}}</a>
                                </li>
                                <li><a ng-show="currentPageOfServant<totalPageOfServant" ng-click="changePageOfServant(currentPageOfServant+1)">
                                    <i class="fa fa-chevron-right"></i></a>
                                </li>
                                <li><a ng-click="changePageOfServant(totalPageOfServant)">尾页</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="col-lg-12">
    <!--当前位置 start-->
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb">
                <li><a><i class="fa fa-home mrg-r-sm"></i>首页</a></li>
                <li class="active"><span>新的工单</span></li>
            </ol>
            <div class="filter-block pull-left">
                <div class="form-group pull-left">
                    <input type="text" class="form-control" ng-model="search.name" placeholder="请输入联系人">
                </div>
                <div class="form-group pull-left">
                    <input type="text" class="form-control" ng-model="search.phone" placeholder="请输入电话">
                </div>
                <div class="form-group pull-left">
                    <input type="text" class="form-control" ng-model="search.address" placeholder="请输入服务地址"/>
                    <input type="hidden" class="form-control" ng-model="search.status"/>
                    <input type="hidden" class="form-control" ng-model="search.selected_manager_group_id"/>
                </div>
                <!--搜索框 End-->
                <a class="btn btn-success pull-left form-group" ng-click="getList(search)">
                    搜索
                </a>
            </div>
            <div class="filter-block pull-right" style="display: none">
                <div class="checkbox-nice">
                    <input type="checkbox" id="checkbox-1" ng-click="getNewOrderList(search)">
                    {{s}}
                    <label for="checkbox-1">
                        仅显示可抢订单
                    </label>
                </div>
            </div>
        </div>
    </div>
    <!--当前位置 end-->

    <!--代码写在这里-->
    <div class="row">
        <div class="col-lg-12">
            <div class="main-box no-header clearfix">
                <div class="main-box-body clearfix">
                    <div class="table-responsive">
                        <table class="table table-hover table-striped text-center">
                            <thead>
                            <tr>
                                <th class="text-center"><span>订单号</span></th>
                                <th class="text-center"><span>下单时间</span></th>
                                <th class="text-center"><span>联系人</span></th>
                                <th style="width: 66px;" class="text-center"><span>服务项目</span></th>
                                <th class="text-center"><span>服务地址</span></th>
                                <th class="text-center"><span>需求描述</span></th>
                                <th class="text-center"><span>当前服务人员</span></th>
                                <th class="text-center"><span>操作</span></th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr role="row" ng-class="{true: 'tr_bg'}[item.af]" ng-repeat="item in list "
                                id="{{item.order_id}}" on-finish-render-filters>
                                <td>
                                    <span ng-if="item.cross_app_id == baas_yl_app_id" style="color: #ff0000; font-size: 12px; vertical-align: text-top;"></span>{{item.order_id}}<br>
                                </td>
                                <td>{{item.create_time}}</td>
                                <td>{{item.name}}</td>
                                <td>{{item.serviceType3_title}}</td>
                                <td>{{item.address}}</td>
                                <td>{{item.detail}}</td>
                                <td>
                                    <a href="javascript:void(0);"
                                       ng-if="item.selected_company_code==''||item.selected_company_code==manager_company_code || item.selected_company_code==undefined"
                                       class="md-trigger " data-modal="modal"
                                       ng-model="item.selected_servant_name" ng-click="passOrder(item)">
                                        <span ng-if="item.selected_servant_name==''|| item.selected_servant_name==undefined">请选择服务人员</span>
                                        <span ng-if="item.selected_servant_name!=''&& item.selected_servant_name!=undefined">{{item.selected_servant_name}}</span>
                                    </a>
                                    <span ng-if="item.status!='待受理'">{{item.selected_servant_name}}</span>
                                </td>
                                <td>
                                    <a href="#/order/grab/detail/{{item.order_id}}" class="table-link" title="查看详情">
                                        <span class="fa-stack">
                                            <i class="fa fa-square fa-stack-2x"></i>
                                            <i class="fa fa-search-plus fa-stack-1x fa-inverse"></i>
                                        </span>
                                    </a>
                                    <a ng-show="item.tag==1" class="btn btn-primary"
                                       ng-click="grab(item.order_id,item.selected_servant_id)">接单</a>
                                    <a ng-show="item.tag==2" class="btn btn-success "
                                       ng-click="grab(item.order_id,item.selected_servant_id)">派工</a>
                                    <input ng-show="item.tag==3" type="button" class="btn btn-warning" value="已被抢" disabled/>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <ul class="pagination pull-right">
                        <li><a>总条数：{{count}}</a></li>
                        <li><a>总页数：{{totalPage}}</a></li>
                        <li><a ng-click="changePage(1)">首页</a></li>
                        <li><a ng-show="currentPage>1" ng-click="changePage(currentPage-1)"><i class="fa fa-chevron-left"></i></a></li>
                        <!--<li><span ng-show="frontdotShow">…</span></li>-->
                        <li ng-repeat="item in pageList" ng-click="changePage(item.number)" class="{{item.active}}"><a>{{item.number}}</a></li>
                        <!--<li><span ng-show="backdotShow">…</span></li>-->
                        <li><a ng-show="currentPage<totalPage" ng-click="changePage(currentPage+1)"><i class="fa fa-chevron-right"></i></a></li>
                        <li><a ng-click="changePage(totalPage)">尾页</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!--代码写在这里  end-->
</div>

<div class="md-overlay"></div>
<script src="../default/js/modernizr.custom.js"></script>
<script src="../default/js/classie.js"></script>
<script src="../default/js/modalEffects.js"></script>
<script type="text/javascript">
    function init() {
        var overlay = document.querySelector('.md-overlay');
        [].slice.call(document.querySelectorAll('.md-trigger')).forEach(function (el, i) {
            var modal = document.querySelector('#' + el.getAttribute('data-modal')),
                    close = modal.querySelector('.md-close');

            function removeModal(hasPerspective) {
                classie.remove(modal, 'md-show');
                if (hasPerspective) {
                    classie.remove(document.documentElement, 'md-perspective');
                }
            }

            function removeModalHandler() {
                removeModal(classie.has(el, 'md-setperspective'));
            }

            el.addEventListener('click', function (ev) {
                classie.add(modal, 'md-show');
                overlay.removeEventListener('click', removeModalHandler);
                overlay.addEventListener('click', removeModalHandler);
                if (classie.has(el, 'md-setperspective')) {
                    setTimeout(function () {
                        classie.add(document.documentElement, 'md-perspective');
                    }, 25);
                }
            });
            close.addEventListener('click', function (ev) {
                ev.stopPropagation();
                removeModalHandler();
            });
            $(document).keyup(function (e) {
                if (e.keyCode == 27) {
                    e.stopPropagation();
                    removeModalHandler();
                }
            });
        });
    }
    function closeMod() {
        $(".md-close").click();
    }

</script>